//
//  PGReweetStatusCell.swift
//  PGWeibo
//
//  Created by Apple on 15/11/11.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

class PGReweetStatusCell: PGStatusCell {

    override var viewModel: PGStatusViewModel? {
        didSet{
            
            reweetedLabel.text = viewModel?.reweetedText
            
        }
    }
    
/// 懒加载控件
    ///背景的灰色按钮
    private lazy var BackButton :UIButton = {
        let btn = UIButton()
        btn.backgroundColor = UIColor(white: 0.99, alpha: 1.0)
        return btn
    }()
    
    //转发的标签
    private lazy var reweetedLabel: UILabel = UILabel(title: "转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博", textFont: 14, color: UIColor.darkGrayColor(), screenInset: statusCellMargin)
    

}
// MARK: - 设置UI
extension PGReweetStatusCell {
    override func setupUI() {
        super.setupUI()
        
        contentView.insertSubview(BackButton, belowSubview: pictureView)
        contentView.insertSubview(reweetedLabel, aboveSubview: BackButton)
        
        /// 约束
        BackButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(contentLabel.snp_bottom).offset(statusCellMargin)
            make.left.equalTo(contentView.snp_left)
            make.right.equalTo(contentView.snp_right)
            make.bottom.equalTo(bottomView.snp_top)
        }
        reweetedLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(BackButton.snp_top).offset(statusCellMargin)
            make.left.equalTo(BackButton.snp_left).offset(statusCellMargin)
        }
        pictureView.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(contentLabel.snp_left)
            make.top.equalTo(reweetedLabel.snp_bottom).offset(statusCellMargin)
            make.width.equalTo(200)
            make.height.equalTo(100)
        }

    }
}
